package com.learning;

/**
 * @author： ygl
 * @date： 2018/10/09
 * @Description：
 */
public class Test005 {

    public static void main(String[] args) {
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 30; i++) {
                    try {
                        Thread.sleep(300);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    System.out.println("子--------i:"+i);
                }
            }
        });
        // 该线程为守护线程和主线程一起销毁
        t1.setDaemon(true);
        t1.start();
        for (int i = 0; i < 5; i++) {
            try {
                Thread.sleep(300);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("主--------i:"+i);
        }
        System.out.println("主线程执行完毕－－－－－－");
    }
}
